Detect assignments in calls to avoid false positive lints #639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses posit-dev/positron#3048.
Positron Notes
Release Notes
New Features
Bug Fixes
list(x <- 1)
) are now detected by the missing symbol linter to avoid annoying false positive diagnostics (Diagnostics: No symbol in scope when assigning variables in function calls positron#3048). The downside is that this causes false negatives when the assignment happens in a call with local scope, e.g. inlocal()
ortest_that()
. In these cases the nested assignments will incorrectly overlast the end of the call. We prefer to be overly permissive than overly cautious in these matters.QA Notes
Assignments in calls, e.g.
list(x <- 1)
should now be treated the same as at top-level. Any further references tox
at top level should not be linted, e.g.y
should cause a lint but notx
in:Note that calls can be nested
list(x <- 1, list(y, x, y <- 2), 1, y)
.In that example, the first
y
should in principle be linted as it hasn't been defined yet but we don't support this sort of lints inside arguments yet.